input_sequence = input('Введите скобучную последовательность: ')
stack = [char for char in input_sequence if char in '<>[]{}()']

index = 0
while index + 1 < len(stack):
    if stack[index] == '<' and stack[index + 1] == '>':
        stack.pop(index)
        stack.pop(index)
        index = 0
    elif stack[index] == '(' and stack[index + 1] == ')':
        stack.pop(index)
        stack.pop(index)
        index = 0
    elif stack[index] == '{' and stack[index + 1] == '}':
        stack.pop(index)
        stack.pop(index)
        index = 0
    elif stack[index] == '[' and stack[index + 1] == ']':
        stack.pop(index)
        stack.pop(index)
        index = 0
    else:
        index += 1

print('True' if len(stack) == 0 else 'False')
